package neu.soft.feignclient;


import neu.soft.entity.Inventory;
import neu.soft.vo.ResultBean;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.Map;

/**
 * 服务通信通过openfeign，注意该接口的方法与feignClient注解中value所指明的服务下的通过路径访问的controller下方法相同
 * 只要访问路径需要加上是value指明的server下哪一个controller类
 * 同时包含服务降级处理，采用工厂方式，方便异常处理，优先级要高于统一异常处理
 */
@FeignClient(value = "warehouse-server", fallbackFactory = WarehouseFeignClientFallBackFactory.class)
public interface WarehouseFeignClient {

    @RequestMapping("/entryOrder/queryEntryOrder")
    ResultBean<List<Map<String, Object>>> queryEntryOrder(@RequestBody Map<String, Object> map);

    @RequestMapping("/outOrder/queryOutOrder")
    ResultBean<List<Map<String, Object>>> queryOutOrder(@RequestBody Map<String, Object> map);

    @RequestMapping("/inventory/queryInventoryNum")
    ResultBean<Integer> queryInventoryNum(@RequestBody Map<String, Object> map);

    @RequestMapping("/inventory/queryInventoryByCodeList")
    List<Inventory> queryInventoryByCodeList(@RequestBody List<String> codeList);

}
